#ifndef RANDOM_H
#define RANDOM_H

#include <iostream>
#include <vector>
#include <time.h>
#include <math.h>
#include "sorting.h"
using namespace std;

#define one_second 1000000;

vector<int> random_array(int n,double pct)
{
	int sve  =  n*pct;
	vector<int> rdarr;
	for(int i=1 ;i < n; i++)
		rdarr.push_back(i);
	random_shuffle(rdarr.begin(),rdarr.end());
	sort(rdarr.begin(),rdarr.begin()+sve);
	return rdarr;
}

void sorting()
{
	double pct[4]={0.01,0.10,0.9,0.99};
	double start,end,dur;
	for(int i = 0; i < 4 ; i++)
	{
		for(int k = 1; k <= 10 ; k++)
		{
			vector<int> sample_arr = random_array(k*10000,pct[i]);
			vector<int> _arr = sample_arr;
			start = clock();
			heapsort(_arr);
			end = clock();
			dur = (end - start)/one_second;
			cout << "Heap " << k*10000 << " " << pct[i] << " " << dur << "s" << endl;
			_arr = sample_arr;
			start = clock();
			quicksort(_arr);
			end = clock();
			dur = (end - start)/one_second;
			cout << "Quick" << k*10000 << " " << pct[i] << " " << dur << "s" << endl;
		}
	}
}

#endif

